<template>
  <footer class="footer">
    <span class="todo-count">剩余<strong>{{ length }}</strong></span>
    <ul class="filters">
      <li>
        <a :class="{selected:type === 'all'}" href="javascript:;" 
        @click="$emit('changeShow','all')">全部</a>
      </li>
      <li>
        <a href="javascript:;"
        :class="{selected:type === 'no'}"
         @click="$emit('changeShow','no')">未完成</a>
      </li>
      <li>
        <a href="javascript:;" 
        :class="{selected:type === 'yes'}"
        @click="$emit('changeShow','yes')">已完成</a>
      </li>
    </ul>
    <button class="clear-completed" @click="clearFn">清除已完成</button>
  </footer>
</template>

<script>
export default {
  props:{
    type:String,
    length:Number,
  },
  methods:{
    clearFn(){
      this.$emit('cleartask','no')
    }
  }
}
</script>